﻿using System;
using System.Collections.Generic;
using System.Text;
using AntC.AspNetCore.ApiEncryption;

namespace Microsoft.AspNetCore.Builder
{
    /// <summary>
    /// api encryption extensions for ApplicationBuilder
    /// </summary>
    public static class ApiEncryptionExtensions
    {
        /// <summary>
        /// use api encryption middleware
        /// </summary>
        /// <param name="app"></param>
        /// <returns></returns>
        public static IApplicationBuilder UseApiEncryption(this IApplicationBuilder app)
        {
            if (app == null)
            {
                throw new ArgumentNullException(nameof(app));
            }

            return app.UseMiddleware<ApiEncryptionMiddleware>();
        }
    }
}
